#include <stdio.h>
int leap(int y){
	return ((y%4==0&&y%100!=0)||y%400==0);
}

int main(){
	int y;
	scanf("%d",&y);
	printf("%d\n",leap(y));
	return 0;
}

